package com.tian;

import com.tian.factory.ApplicationContextFactory;
import com.tian.init.StationGunLoadInitCache;
import com.tian.netty.core.ChargeCenterServer;
import com.tian.util.Utility;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * {@code @description:} 充电桩与设备端服务启动类
 *
 * influxdb启动命令
 * influxd.exe -config influxdb.conf
 *
 * @author tianwc 公众号：Java后端技术全栈
 * 在线刷题 1200+java面试题和1000+篇技术文章：<a href="https://woaijava.cc/">博客地址</a>
 * {@code @date:} 2024-08-23 22:05
 * {@code @version:} 1.0
 */
@Slf4j
@SpringBootApplication
public class CoreApplication {
    public static void main(String[] args)   {
        ConfigurableApplicationContext context = SpringApplication.run(CoreApplication.class, args);
        ApplicationContextFactory.setApplicationContext(context);
        context.getBean(StationGunLoadInitCache.class).initDataCache();
        Utility.setApplicationContext(context);
        try {
            ChargeCenterServer.start();
        } catch (Exception e) {
            log.error("netty start failed", e);
        }
    }
}
